package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.OpenConsigneeSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerConsigneeAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.consignee.Consignee;
import com.wlyuan.open.scanner.repository.ConsigneeRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.CONSIGNEE)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerConsigneeHandler extends BaseScannerHandler<Consignee, OpenConsigneeSyncDTO> {
    private final ConsigneeRepository consigneeRepository;

    @Override
    protected List<Consignee> select() {
        return consigneeRepository.list();
    }

    @Override
    protected List<OpenConsigneeSyncDTO> assembler(List<Consignee> data) {

        return ScannerConsigneeAssembler.assemble(data);

    }

}
